Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(playground): expose esm-browser files #9725

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

pikax
Copy link
Member

@pikax pikax commented Nov 30, 2023

Useful feature if what you trying to reproduce needs vue compiler to run in the browser, eg: #9724

<script setup>
import { createApp, onMounted } from 'vue'

onMounted(() => {
  const App = {
    template: `
    <div>
      <p>
        <i>Hello</i>
        <b>world</b>!
      </p>
    </div>
  `,
  };

  // If you comment out the line below, app2 suddenly respects its whitespace setting.
  // As-is, both apps render as if whitespace = 'condense'.
  // If you move this after app2's creation, both apps behave as if whitespace = 'preserve'
  const app = createApp(App).mount("#test");

  const app2 = createApp(App);
  app2.config.compilerOptions.whitespace = 'preserve';
  app2.mount('#test2');
})
</script>

<template>
  <h2>Vue 3 default compiler options</h2>
  <div id="test" />
  <h2>Vue 3 with whitespace: preserve</h2>
  <div id="test2" />
</template>

playground working

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 86.7 kB 33 kB 29.8 kB
vue.global.prod.js 133 kB 49.8 kB 44.6 kB

Usages

Name Size Gzip Brotli
createApp 48.2 kB 19 kB 17.4 kB
createSSRApp 51.5 kB 20.3 kB 18.5 kB
defineCustomElement 50.6 kB 19.7 kB 18 kB
overall 61.6 kB 23.8 kB 21.7 kB

Copy link

netlify bot commented Nov 30, 2023

Deploy Preview for vue-sfc-playground failed.

Name Link
🔨 Latest commit 1b4b2a4
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/6568bb2c6f4b680008a7ce95

@yyx990803 yyx990803 merged commit 243f504 into main Dec 4, 2023
15 checks passed
@yyx990803 yyx990803 deleted the pikax/playground_expose_esm-browser branch December 4, 2023 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants